import type { Active, Actives, Digg } from "@/types/Active";
import type { Recal } from "@/types/Recall";
import type { Avatars } from "@/types/Avatars";
import type { Banner } from "@/types/Banner";
import type { News } from "@/types/News";
import type { BKResponse } from "@/types/Response";
import BkRequestManager from "@/utils/BKRequestManage";
import type { navList, navtag } from "@/types/navigation";
import type { counts, tags } from "@/types/Home";

export class HomeAPI{
     // 轮播图
     static getBanners(){
       return BkRequestManager.instance.request<BKResponse<Banner[]>>({
             url:'api/Beijinimg/'
        })
     }
     // 首页收藏文章排行
     static getPopularActive(){
          return BkRequestManager.instance.request<BKResponse<Active[]>>({
                url:'api/PopularActive/'
           })
        }
     // 首页最新修改文章排行
     static getChange_dateActive(){
          return BkRequestManager.instance.request<BKResponse<Active[]>>({
                url:'api/Change_dateActive/'
           })
        }
     // 首页无限滚动文章
     static getActives(page:number){
          return BkRequestManager.instance.request<BKResponse<Actives>>({
                url:`api/Article_all/${page}`
           })
        }
         //新闻       
         static news_list(data:any){
          return BkRequestManager.instance.request<BKResponse<News[]>>({
            url: "api/news_list/",
            data, 
            method: 'post'
           })
         }     
      //获取头像列表
    static Avatars_img(){
     return BkRequestManager.instance.request<BKResponse<Avatars[]>>({
           url:'api/via_img/',
      })
   }           
      //删除头像
      static delete_Avatars(nid:string){
         return BkRequestManager.instance.request({
               url:`api/upload/avatar/${nid}/`,
               method: 'delete'
          })
       }     
      //删除文章封面
      static delete_Cover(nid:number){
         return BkRequestManager.instance.request({
               url:`api/upload/cover/${nid}/`,
               method: 'delete'
          })
       }      
      //回忆录配图
      static uploadImgFromPaste(data:{image:string}){
         return BkRequestManager.instance.request({
               url:"api/paste_upload/",
               method: 'post',
               data,
          })
       }
      //添加回忆录
      static history_add(data:Recal){
         return BkRequestManager.instance.request({
            url:"api/history_add/",
            method: 'post',
            data,
            
       })
      }
      //获取回忆录信息
      static get_recall(){
         return BkRequestManager.instance.request<BKResponse<Recal[]>>({
            url:"api/get_recal/",
       })
      }
      //删除回忆录
      static delete_recall(nid:string){
         return BkRequestManager.instance.request({
            url:`api/delete_recall/${nid}/`,
            method:'delete'
       })
      }
      //添加导航标签
      static Navigation_add(data:navtag){
         return BkRequestManager.instance.request({
            url:"api/Navigation_add/",
            method: 'post',
            data
            
       })
      }
      //获取导航标签
      static get_Navigation(){
         return BkRequestManager.instance.request<BKResponse<navtag[]>>({
            url:"api/get_Navigation/",  
       })
      }
      //删除导航标签
      static delete_Navigation(nid:number){
      return BkRequestManager.instance.request({
         url:`api/delete_Navigation/${nid}/`,
         method:'delete'
    })
      }
      //获取导航信息列表
      static get_NavLists(data:navtag){
        return BkRequestManager.instance.request<BKResponse<navList[]>>({
         url:"api/get_NavLists/",
         method: 'post',
         data
       })
      }   
      //添加导航信息
      static add_Navsmg(data:navList){
         return BkRequestManager.instance.request({
          url:"api/add_Navsmg/",
          method: 'post',
          data
        })
    }   
      //删除导航信息
      static delete_Navsmg(nid:number){
      return BkRequestManager.instance.request({
         url:`api/delete_Navsmg/${nid}/`,
         method:'delete'
    })
      }  
   //导航信息点赞
    static Navmsg_digg(nid:number){
      return BkRequestManager.instance.request<BKResponse<Digg>>({
            url: `api/Navmsg_digg/${nid}/`,
            method: 'put'
       })
    } 
     //导航收藏
    static Navmsg_collects(nid:number){
            return BkRequestManager.instance.request<BKResponse<Digg>>({
                  url: `api/Navmsg_collects/${nid}/`,
                  method: 'put'
             })
          } 
   //标签云
   static Tags(){
      return BkRequestManager.instance.request<BKResponse<tags[]>>({
         url: 'api/Tags/',
       
    })
   }
 //各种数量
 static Counts(){
   return BkRequestManager.instance.request<BKResponse<counts>>({
      url: 'api/counts/',
    
 })
}   
}